layui.use(['form', 'table', 'laydate', 'layarea', 'tableSelect'], function () {
    let $ = layui.jquery,
        form = layui.form,
        table = layui.table;

    //编辑订单
    $(".data-count-edit").click(function (re) {
        let mod_id=$(re.currentTarget).parents('tr').eq(0).attr('id')
        let index = layer.open({
            title: '修改订单状态',
            type: 2,
            shade: 0.2,
            maxmin: true,
            shadeClose: true,
            area: ['50%', '50%'],
            content: '/admin/OrderData/EditStatus?mod_id='+mod_id,
        });
    })

    //删除订单

    $(".data-count-del").click(function (re) {
        let mod_id=$(re.currentTarget).parents('tr').eq(0).attr('id')

        layer.confirm('确认删除么？', function (index) {

            $.ajax({
                url: '/admin/OrderData/DelData',
                type: 'post',
                dataType: 'json',
                data: {
                    mod_id: mod_id,

                },
                success: function(data) {
                    if (data.status) {
                        layer.msg('删除成功!', {icon: 1, time: 1000},function () {
                            $(re.currentTarget).parents('tr').eq(0).remove()
                            // location.reload()
                        });
                    }else{
                        layer.msg(data.msg, {
                            icon: 2,
                            time: 3000
                        });

                    }

                },
                error: function(re) {

                    layer.open({
                        title: '删除失败',
                        content: '<span style="color:red">'+re.responseJSON.errorCode+':</span>'+re.responseJSON.msg
                    })
                }
            });
            // obj.del();
            // layer.close(index);
        });
    })
});